#include "StringManager.h"
#include "..\\PreCompileProcessor\\Hashing.h"
#include "FileSystem.h"
#include "Constants.h"

namespace CEngine {

namespace {
    bool initialized = false;
    void isInitialized(void);
}

namespace StringManager {

    void
    initialize(void) {
        initialized = true;
    }

    StringID
    hashString(const CHAR* string) {
        StringID hash = 0;
        for(int i = 0; string[i] != '\0'; i++) {
            hash = (hash * Constants::String::hashSeed) + string[i];
        }
       return hash;
    }

    void
    customInitialize(void) {
        initialized = true;
    }

}

namespace {
    void
    isInitialized(void) {
        if(!initialized) {
            defaultLog.log(Logging::STRINGS, LOG_ERROR, "Attempted to use string manager before it was initialized!\n");
        }
    }
}

}
